<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2020/3/17
  Time: 17:43
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>

    <script src="js/jquery.min.js"></script>

    <script>
        //页面加载，绑定单机事件
        $(function () {
            $("#btn").click(function () {
                //alert("hello btn");
                //发送ajax请求
                $.ajax({
                    //编写json格式，设置属性
                    url : "user/testAjax",
                    contentType : "application/json;charset=UTF-8",
                    data : '{"username":"小刘","password":"666666","age":21}',
                    dataType : "json",
                    type : "post",
                    success : function (data) {
                        //data服务器端响应的json的数据，进行解析
                        alert(data);
                    }
                });
            });
        });

    </script>
</head>
<body>
<a href="user/testString">testString测试</a><br>

<a href="user/testVoid">testVoid测试</a><br>

<a href="user/testModelAndView">testModelAndView测试</a><br>

<a href="user/testForwardOrRedirect">testForwardOrRedirect测试</a><br>

<button id="btn">发送ajax的请求</button><br>

</body>
</html>
